package config

import (
	"github.com/jmoiron/sqlx"
	"time"
)

var DB *sqlx.DB

func config() {
	dsn := "root:123456@tcp(127.0.0.1:3306)/mxshop_userop_srv?charset=utf8mb4&parseTime=True&loc=Local"
	var err error
	DB, err = sqlx.Connect("mysql", dsn)
	if err != nil {
		panic(err)
	}
	DB.SetConnMaxLifetime(time.Minute * 3)
	DB.SetMaxOpenConns(10)
	DB.SetMaxIdleConns(10)
}
